package com.qcby.util;

import com.qcby.query.TrainNumQuery;

import java.io.*;

import java.io.*;

public class DeepCopyUtil {

    public static TrainNumQuery deepCopyTrainNumQuery(TrainNumQuery object) {
        try {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            ObjectOutputStream oos = new ObjectOutputStream(baos);
            oos.writeObject(object);

            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
            ObjectInputStream ois = new ObjectInputStream(bais);
            return (TrainNumQuery) ois.readObject();
        } catch (IOException | ClassNotFoundException e) {
            throw new RuntimeException("Deep copy failed", e);
        }
    }
}